limsMaterialApply.searchPage = {

    getGridParam: function () {
        var _this = this;
        return {
            type: 'grid',
            id: _this.idManager.materialApplyGrid,
            url: _this.urlManager.materialApplyGrid + '/queries/searchable',
            columns: limsMaterialApply.getAuditListColumns(),
            onLoadSuccess: function (data) {
                if (!Gikam.isEmpty(data)) {
                    this.activeRowByIndex(0)
                } else {
                }
            },
            onRowActive: function (index, row) {
            },
            page: true,
            onCellClick: function (field, row) {
                field === 'applyCode' && _this.loadDetailPage(row);
            },
        }
    },

    loadDetailPage: function (row, readonly) {
        workspace.window.load(limsMaterialApply.baseUrl + '/page/audit-search-detail' + Gikam.param({
            id: row.id,
            step: 'search'
        }))
    },

    idManager: {
        materialApplyGrid: 'lims-material-apply-search-list-grid',
    },

    urlManager: {
        materialApplyGrid: limsMaterialApply.baseUrl,
    },

    create: function () {
        var _this = this;
        Gikam.create('layout', {
            id: 'lims-material-apply-search-list-layout',
            renderTo: workspace.window.$dom,
            center: {
                items: [this.getGridParam()]
            }
        });
    },

    init: function () {
        this.create();
    }
};
